#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 405;
const int MOD = 1e9 + 7;

int n, m;
int a[N][N << 1];
ll fastpow(ll b, ll p) {
  ll res = 1;
  while (p) {
    if (p & 1) res = res * b % MOD;
    b = b * b % MOD;
    p >>= 1;
  }
  return res;
}
bool gauss() {
  rep(r, 1, n) {
    // row selection
    int now = r;
    rep(i, r, n) if (abs(a[i][r]) > abs(a[now][r])) now = i;
    if (a[now][r] == 0) return false;
    rep(j, 1, n * 2) swap(a[r][j], a[now][j]);

    // row normalization
    ll x = fastpow(a[r][r], MOD - 2);
    rep(j, 1, n * 2) a[r][j] = a[r][j] * x % MOD;

    // substraction
    rep(i, 1, n) {
      if (i == r) continue;
      x = a[i][r];
      rep(j, 1, n * 2) a[i][j] = (a[i][j] - x * a[r][j] % MOD + MOD) % MOD;
    }
  }
  return true;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  rep(i, 1, n) rep(j, 1, n) cin >> a[i][j];
  rep(i, 1, n) a[i][i + n] = 1;
  if (!gauss())
    cout << "No Solution";
  else {
    rep(i, 1, n) rep(j, 1, n) cout << a[i][j + n] << " \n"[j == n];
  }
  return 0;
}